package com.alks.function.controller.style;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.imes.TrailTaskProcess;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.service.SdStyleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author:hxl
 * @create: 2024-08-07 14:28
 * @Description:
 */
@ApiRestController("/produCollection")
@Api(tags = "技转小程序")
public class ProductionCollectionController {
    @Autowired
    private SdStyleService sdStyleService;
    @PostMapping({"/queryTrailTaskProcess"})
    @ApiOperation("查询")
    @WebLogger
    public  ResponseInfo queryTrailTaskProcess(@RequestBody TrailTaskProcess trailTaskProcess) {
        return this.sdStyleService.selectByExample(trailTaskProcess);
    }

    @PostMapping({"/queryByQrCode"})
    @ApiOperation("扫描二维码")
    @WebLogger
    public ResponseInfo queryByQrCode(@RequestParam String qrCode) {
        return this.sdStyleService.queryByQrCode(qrCode);
    }

    @PostMapping({"/addTrailTaskProcess"})
    @ApiOperation("设置数量")
    @WebLogger
    public ResponseInfo addTrailTaskProcess(@RequestBody TrailTaskProcess trailTaskProcess){
        return this.sdStyleService.addTrailTaskProcess(trailTaskProcess);
    }

    @GetMapping({"/getTime"})
    @ApiOperation("获取时间")
    @WebLogger
    public String getTime(){
        Date date = new Date();
        String s = new SimpleDateFormat("yyyy-MM-dd").format(date);
        return s;
    }
    @PostMapping("/deleteDataByRowId")
    @ApiOperation("品控采集删除")
    @WebLogger
    public ResponseInfo deleteDataByRowId(@RequestBody TrailTaskProcess trailTaskProcess){
        return this.sdStyleService.deleteDataByRowId(trailTaskProcess);
    }
}
